#@layout()
#define main()
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">新闻管理</div>
                </div>
                <div class="widget-body  am-fr">
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <a class="am-btn am-btn-default am-btn-success" href="/admin/news/add"><span class="am-icon-plus"></span> 新增</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                        <div class="am-form-group tpl-table-list-select">
                            <select data-am-selected="{btnSize: 'sm'}">
                                <option value=0>全部</option>
                                #for(c : channels)
                                    <option value=#(c.value)>#(c.name)</option>
                                #end
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                        <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                            <input type="text" class="am-form-field ">
                            <span class="am-input-group-btn">
                                <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="button"></button>
                            </span>
                        </div>
                    </div>

                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="example-r">
                            <thead>
                            <tr>
                                <th>封面图</th>
                                <th>标题</th>
                                <th>时间</th>
                                <th>频道</th>
                                <th>类型</th>
                                <th>创建者</th>
                                <th>状态</th>
                                <th>是否置顶</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            #for(x : newsPage.getList())
                            <tr class="gradeX">
                                <td class="am-text-middle">
                                    <img onerror="this.src='/admin/common/AmazeUI/img/k.jpg'" src="#(x.cover)"  class="tpl-table-line-img" alt="">
                                </td>
                                <td class="am-text-middle">#(x.title)</td>
                                <td class="am-text-middle">#(x.time)</td>
                                <td class="am-text-middle">
                                    #for(c : channels)
                                        #if(c.value.toInt()==x.channel)
                                            #(c.name)
                                        #end
                                    #end
                                </td>
                                <td class="am-text-middle">
                                    #if(x.type == 1)
                                    直接渲染
                                    #elseif(x.type == 2)
                                    模板
                                    #else
                                    链接
                                    #end
                                </td>
                                <td class="am-text-middle">
                                    #for(u : userList)
                                        #if(x.creator == u.id)
                                            #(u.name?u.name:u.account)
                                        #end
                                    #end
                                </td>
                                <td class="am-text-middle">
                                    #if(x.status == 1)
                                    草稿
                                    #elseif(x.status == 2)
                                    发布
                                    #else
                                    下线
                                    #end
                                </td>
                                <td class="am-text-middle">#(x.top?'是':'否')</td>
                                <td class="am-text-middle">
                                    <div class="tpl-table-black-operation">
                                        #ifHasAuth("/admin/news/update")
                                        <a href="/admin/news/edit/#(x.id)">
                                            <i class="am-icon-pencil"></i> 编辑
                                        </a>
                                        #end
                                        #ifHasAuth("/admin/news/delete")
                                        <a href="/admin/news/delete/#(x.id)" class="tpl-table-black-operation-del">
                                            <i class="am-icon-trash"></i> 删除
                                        </a>
                                        #end
                                    </div>
                                </td>
                            </tr>
                            #end
                            </tbody>
                        </table>
                    </div>
                    #@paginate(newsPage.pageNumber, newsPage.totalPage, "/admim/news/")
                </div>
            </div>
        </div>
    </div>
</div>
#end